package schema

import (
	"entgo.io/ent"
	"entgo.io/ent/schema/edge"
	"entgo.io/ent/schema/field"
)

// ReportMalware holds the schema definition for the ReportMalware entity.
type ReportMalware struct {
	ent.Schema
}

// Fields of the ReportMalware.
func (ReportMalware) Fields() []ent.Field {
	return []ent.Field{
		field.String("analysis_id").NotEmpty(),
		field.Bool("is_malware").Default(false),
		field.Bool("is_suspicious").Default(false),
		field.String("confidence").Optional(),
		field.JSON("report", map[string]interface{}{}).Optional(),
		field.JSON("verification_record", map[string]interface{}{}).Optional(),
		field.Time("created_at").Optional(),
		field.Time("updated_at").Optional(),
	}
}

// Edges of the ReportMalware.
func (ReportMalware) Edges() []ent.Edge {
	return []ent.Edge{
		edge.From("package", ReportPackage.Type).
			Ref("malware_analysis").
			Unique(),
	}
}
